package ca.etsmtl.log320.pusher;

public class Move {

	private String _completeMove;
	
	private int iStart;
	private int jStart;
	private int iEnd;
	private int jEnd;
	
	public Move(String move){
		// j'assume que les valeurs varie de 0-7
		iStart = (int)move.charAt(1)-65; // A = 65
		jStart = 7-((int)move.charAt(2)-49); // 1 = 49
		iEnd   = (int)move.charAt(6)-65; // A = 65
		jEnd   = 7-((int)move.charAt(7)-49); // 1 = 49
	}
	
	public Move(int iStart, int jStart, int iEnd, int jEnd){
		this.iStart = iStart;
		this.jStart = jStart;
		this.iEnd	= iEnd;
		this.jEnd	= jEnd;
		
		int formattedJStart= (8-jStart);
		int formattedJEnd= (8-jEnd);
		_completeMove = ((char)(iStart+65))+String.valueOf(formattedJStart)+((char)(iEnd+65))+String.valueOf(formattedJEnd);
	}
	
	public String toString(){		
		return _completeMove;
	}
	
	public boolean equals(Move toCompare){
		return this._completeMove.equals(toCompare._completeMove);
		
	}
	
	public String getCompleteMove(){
		return _completeMove;
	}


	public void setIStart(int iStart) {
		this.iStart = iStart;
	}


	public int getIStart() {
		return iStart;
	}


	public void setJStart(int jStart) {
		this.jStart = jStart;
	}


	public int getJStart() {
		return jStart;
	}


	public void setIEnd(int iEnd) {
		this.iEnd = iEnd;
	}


	public int getIEnd() {
		return iEnd;
	}


	public void setJEnd(int jEnd) {
		this.jEnd = jEnd;
	}


	public int getJEnd() {
		return jEnd;
	}
}
